package org.jpro;

import org.jpro.common.jpa.repository.JpaRepositoryFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import lombok.extern.slf4j.Slf4j;

/**
 * <P>功能描述 : 项目启动入口 </P>
 * <P>File name : Application </P>
 * <P>Author : 王泽浩 </P>
 * <P>E-Mail : 1028625100@qq.com </P>
 * <P>Date : 2017/2/24 下午3:22</P>
 */
@Slf4j
@SpringBootApplication
@ServletComponentScan// 这个就是扫描相应的Servlet包;
@EnableAutoConfiguration
@EnableTransactionManagement// 启注解事务管理，等同于xml配置方式的 <tx:annotation-driven />
@EnableJpaRepositories(repositoryFactoryBeanClass = JpaRepositoryFactoryBean.class)// 指定自己的JPA工厂类
public class Application extends SpringBootServletInitializer {

    /**
     * <P>功能描述 : 项目启动main方法</P>
     * <P>Method Name : main </P>
     * <P>Author : 王泽浩 </P>
     * <P>E-Mail : 1028625100@qq.com </P>
     * <P>Date : 2017-02-24 15:22:55</P>
     * @param args the input arguments
     * @since 1.0
     */
    public static void main(String[] args) {

        log.info("程序正在启动...");

        SpringApplication.run(Application.class, args);

        log.info("程序已经启动...");

    }

    // 部署到JavaEE容器打开此注释即可,并修改pom文件中jar 为 war
    /*
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(this.getClass());
    }*/

}
